package org.anyin.gitee.cloud.center.base.model.enums;

import org.anyin.gitee.cloud.lib.core.enums.BaseEnum;

public enum SexEnum implements BaseEnum {
    MAN("man", "男"),
    WOMAN("woman", "女"),
    ;

    private String code;
    private String text;

    SexEnum(String code, String text) {
        this.code = code;
        this.text = text;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getText() {
        return text;
    }

    public static SexEnum get(String code){
        for(SexEnum item : values()) {
            if(code.equals(item.getCode())){
                return item;
            }
        }
        // 返回默认值或者抛出异常
        return SexEnum.MAN;
    }
}
